package com.lucas.springbootssm.controller;


import com.lucas.springbootssm.dao.UserDao;
import com.lucas.springbootssm.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController//相当于@Controller与@ResponseBody
public class UserController {
//依赖注入
@Autowired
UserDao userMapper;

@RequestMapping(value = "find")
public User findUserByName() {
  //调用dao层
  User user = userMapper.selectUserByName("lucas");
  return user;//返回的是Json数据，因为RestController注解中有@ResponseBody的作用
}


@RequestMapping(value = "test")
public String test() {
  //调用dao层

  return "lucas test success";//返回的是Json数据，因为RestController注解中有@ResponseBody的作用
}
}
